<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>添加下级代理</title>
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 	<script type="text/javascript" src="${pageContext.request.contextPath}/js/theme/jquery.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/layerui/layer.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/layerui/layer.ext.js"></script>
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/skin/css/mobilecss/charge.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/skin/css/mobilecss/main.css">

    <style type="text/css">
        body {
            padding-bottom: 40px;
        }
        .sidebar-nav {
            padding: 9px 0;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }


    </style>
</head>
<body>


<div class="container">
        <p style="font-size: 0.9rem" id="addTitle">添加打款信息</p>
        <p style="font-size: 0.9rem" id="addTitle">&nbsp;</p>
        <div style="font-size: 0.9rem">
            <span style="border:none;padding: 0.5rem;">代理商信息：</span>
            <input type="hidden" name="userId" id="userId" value="${user.id}" >
        	 ${user.phone}&nbsp;/&nbsp;${user.email} 
        </div>
        <div style="font-size: 0.9rem">
        <table>
        <tr>
			<td><span style="border:none;padding: 0.5rem;">收&nbsp;款&nbsp;信&nbsp;息&nbsp;：</span>
			</td>
			<td>
			${bankCard==null?"查无银行卡信息":""}
	        <input type="hidden" name="bankCardId" id="bankCardId" value="${bankCard.id}" >
	        <input type="hidden" name="bankUserName" id="bankUserName" value="${bankCard.bankUserName}" >
	        <p>${bankCard.bankName}</p>
	        <p>${bankCard.bankUserNo}</p>
	        <p>${bankCard.bankUserName}</p>
			</td>
        </tr>
        </table>
            
	        
	        
        </div>
        <div style="border: 1px solid #636363">
            <span style="border:none;padding: 0.5rem;">打款金额：</span>
            <input type="text" id="amount" name="amount" placeholder="最大打款金额 ${user.ticeng}元"  style="border: none;width: 60%">
        </div>
       
        <div style="border: 1px solid #636363">
            <span style="border:none;padding: 0.5rem;">备注</span>
            <input type="text" id="remark" name="remark"  style="border: none;width: 60%">
        </div>
        <div style="margin-top: 3rem">
            <button style="width: 100%" id="usersave" >确认添加</button>
        </div>
    </div>
    

</body>
<script>
    $(function () {       
		$('#backid').click(function(){
			var system ={}; 
	        var p = navigator.platform;      
	        system.win = p.indexOf("Win") == 0; 
	        system.mac = p.indexOf("Mac") == 0; 
	        system.x11 = (p == "X11") || (p.indexOf("Linux") == 0);    
	        if(system.win||system.mac||system.xll){
	    		//如果是电脑跳转到弹出框 
	        	parent.layer.close(parent.lindex);
	        }else{  
	    		//如果是手机,跳转到页签
	    		window.location.href="${pageContext.request.contextPath}/admin/user_next_info.html";
	        }
		 });
	
		
		
		$('#usersave').click(function(){
			$('#usersave').attr('disabled',"true"); //添加disabled属性 
			var bankCardId = $("#bankCardId").val();
			var amount = $("#amount").val();
			var userId = $("#userId").val();
			var remark =$("#remark").val();
			if(amount==""){
				layer.alert("请填写金额");
				return;
			}
			if(bankCardId==""){
				layer.alert("没有银行卡信息，请联系该代理添加银行卡信息");
				return;
			}
			var msg = "添加 打款给  "+$("#bankUserName").val()+" " + amount +"元的记录？";
	    	layer.confirm('确认'+msg, {
	    	    btn: ['确认','取消'], //按钮
	    	    shade: false //不显示遮罩
	    	}, function(){
				$.post("${pageContext.request.contextPath}/admin/tradeFlow_edit_save.html",
			            {"amount":amount,"bankCardId":bankCardId
					,"remark":remark ,"userId":userId},
			       function(data){
			            	var json = eval("("+data+")");
			            	$('#usersave').removeAttr("disabled");  //移除disabled属性 
							if(json.statusCode =='200'){
								layer.msg(json.message, {icon: 1});
								setTimeout("closewind()",2000);
							}else{
	    						layer.msg(json.message, {shift: 6});
	    					}
			      });
			
	    	});
			
		 });
    });
    function closewind(){
    	parent.layer.close(parent.lindex);
    }
</script>
</html>